# detect operating system
ifeq ($(OS),Windows_NT)
    CURRENT_OS := Windows
else
    CURRENT_OS := $(shell uname -s)
endif

#GOBIN
GOBIN = $(shell pwd)/build/bin
GO ?= latest

# variables
BUILD_FLAGS = -tags netgo

all: build

unittest:
	# @go test -v ./internal/...

buildquick:
	echo BUILD_FLAGS=$(BUILD_FLAGS)	
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-1 ./cmd/question/intv-1
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-2 ./cmd/question/intv-2
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-3 ./cmd/question/intv-3
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-4 ./cmd/question/intv-4
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-5 ./cmd/question/intv-5
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-6 ./cmd/question/intv-6
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-1 ./cmd/question/intv-7/1
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-2 ./cmd/question/intv-7/2
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-3 ./cmd/question/intv-7/3
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-4 ./cmd/question/intv-7/4
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-5 ./cmd/question/intv-7/5
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-6 ./cmd/question/intv-7/6
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-7 ./cmd/question/intv-7/7
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-8 ./cmd/question/intv-7/8
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-9 ./cmd/question/intv-7/9
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-10 ./cmd/question/intv-7/10
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-7-11 ./cmd/question/intv-7/11

	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-1 ./cmd/question/intv-8/1
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-2 ./cmd/question/intv-8/2
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-3 ./cmd/question/intv-8/3
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-4 ./cmd/question/intv-8/4
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-5 ./cmd/question/intv-8/5
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-6 ./cmd/question/intv-8/6
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-7 ./cmd/question/intv-8/7
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-8 ./cmd/question/intv-8/8
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-9 ./cmd/question/intv-8/9
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-10 ./cmd/question/intv-8/10
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-8-11 ./cmd/question/intv-8/11

	@go build  $(BUILD_FLAGS) -o ./build/question-intv-9 ./cmd/question/intv-9
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-10 ./cmd/question/intv-10


	@go build  $(BUILD_FLAGS) -o ./build/question-intv-17 ./cmd/question/intv-17

	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-1 ./cmd/question/intv-23/1
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-2 ./cmd/question/intv-23/2
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-3 ./cmd/question/intv-23/3
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-4 ./cmd/question/intv-23/4
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-6 ./cmd/question/intv-23/6
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-7 ./cmd/question/intv-23/7
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-9 ./cmd/question/intv-23/9
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-10 ./cmd/question/intv-23/10
	@go build  $(BUILD_FLAGS) -o ./build/question-intv-23-11 ./cmd/question/intv-23/11
	
	@go build  $(BUILD_FLAGS) -o ./build/algorithm-bubble_sort ./cmd/algorithm/bubble_sort
	@go build  $(BUILD_FLAGS) -o ./build/algorithm-selection_sort ./cmd/algorithm/selection_sort

build: unittest buildquick

clean:
	rm -rf ./build

.PHONY: build 